Part Number Hot Search : 
120N1 VSKTF180 00BZXI CPZRL7 MJE13005 FL127 V470M A102S
Product Description
Full Text Search
 

To Download MAX1258EVKIT Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 19-3324; Rev 0; 6/04
MAX1258 Evaluation Kit/Evaluation System
General Description
The MAX1258 evaluation system (EV system) consists of a MAX1258 evaluation kit (EV kit) and a Maxim 68HC16MODULE-DIP microcontroller (C) module. The MAX1258 offers multichannel, 12-bit, analog-to-digital converters (ADCs); a temperature sensor; octal 12-bit, digital-to-analog converters (DACs); and configurable general-purpose I/O ports (GPIOs). The evaluation software runs under Windows(R) 95/98/2000/XP, providing a handy user interface to exercise the features of the MAX1258. Order the complete EV system (MAX1258EVC16) for a comprehensive evaluation of the MAX1258 using a PC. Order the EV kit (MAX1258EVKIT) if the 68HC16MODULE module has already been purchased with a previous Maxim EV system, or for custom use in other Cbased systems. This system can also evaluate the MAX1057/MAX1058/ MAX1257. See the Detailed Description of Hardware section for more details. Contact the factory for free samples of these products. o Proven PC Board Layout o Complete Evaluation System o Convenient On-Board Test Points o Data-Logging Software o Fully Assembled and Tested
Features
Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
Ordering Information
PART MAX1258EVKIT MAX1258EVC16 TEMP RANGE 0C to +70C 0C to +70C INTERFACE TYPE User supplied Windows software
Note: The MAX1258 evaluation software is designed for use with the complete evaluation system MAX1258EVC16 (includes 68HC16MODULE-DIP module together with MAX1258EVKIT.) If the MAX1258 evaluation software will not be used, the MAX1258EVKIT board can be purchased by itself, without the C.
MAX1258 Stand-Alone EV Kit
The MAX1258 EV kit provides a proven PC board layout to facilitate evaluation of the MAX1258. It must be interfaced to appropriate timing signals for proper operation. Power the on-board MAX1615 low dropout (LDO) by connecting a user-supplied 6VDC to 28VDC power supply and ground return to terminal block TB1. See Figure 7 and refer to the MAX1258 data sheet for timing requirements.
MAX1258EVC16 System Component List
PART MAX1258EVKIT 68HC16MODULE-DIP QTY 1 1 DESCRIPTION MAX1258 evaluation kit 68HC16 C module
MAX1258 EV System
The MAX1258 EV system operates from a user-supplied 7VDC to 20VDC power supply. The evaluation software runs under Windows 95/98/2000/XP on an IBM PC, interfacing to the EV system board through the computer's serial communications port. See the Quick Start section for setup and operating instructions.
Component Suppliers
SUPPLIER Johanson Dielectric Murata Panasonic Taiyo Yuden TDK PHONE 818-364-9800 770-436-1300 714-373-7366 800-348-2496 847-803-6100 FAX 818-364-6100 770-436-3030 714-737-7323 847-925-0899 847-390-4405 WEBSITE www.johanson-caps.com www.murata.com www.panasonic.com www.t-yuden.com www.component.tdk.com
Note: Indicate you are using the MAX1258 when contacting these component suppliers. Windows is a registered trademark of Microsoft Corporation. ________________________________________________________________ Maxim Integrated Products 1
For pricing, delivery, and ordering information, please contact Maxim/Dallas Direct! at 1-888-629-4642, or visit Maxim's website at www.maxim-ic.com.
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258EVKIT Parts List
REFERENCE QTY DESCRIPTION 0.1F 10%, 16V X7R ceramic capacitors (0805) Murata GRM219R71C104K Johanson 250R15W104KV4Z TDK C2012X7R1C104K-0.85 0.01F 10% ceramic capacitors (0603) Taiyo Yuden UMK107B103KZ TDK C1608X7R1H103K Murata GRM188R71H103K 470pF 10%, 50V X7R ceramic capacitor (0603) Taiyo Yuden UMK107B471KZ TDK C1608X7R1H471K Murata GRM188R71H471K 100pF 5%, 50V C0G ceramic capacitor (0603) Murata GRM1885C1H101J Taiyo Yuden UMK107CH101JZ TDK C1608C0G1H101J 1F 10%, 10V X7R ceramic capacitors (0805) Murata GRM21BR71A105K Taiyo Yuden LMK212BJ105KG TDK C2012X7R1A105K 10F 20%, 6.3V X5R ceramic capacitors (0805) TDK C2012X5R0J106M Taiyo Yuden JMK212BJ106MG Panasonic ECJ2FB0J106M REFERENCE H1-H4 H5, H6, H7 H8 J1 JU1, JU2 JU4, JU5 R18 R19 R1-R17, R22, R23 R20 R21 TB1 U1 U2 U3, U4 QTY 4 3 1 1 2 2 1 1 19 1 1 1 1 1 2 12 pins 2 x 4 dual row header pins 2 x 5 dual row header pin 2 x 20 right angle socket 3 pins 2 pins 100k 5% resistor (1206) 10k 5% resistor (1206) 10 5% resistors (1206) 510 5% resistor (1206) 2k 5% resistor (1206) Two-circuit terminal block MAX1258BETM (48-pin, TQFN, 7mm x 7mm) MAX1615EUK-T, ABZD, SOT23-5 MAX1840EUB (MAX-10) or MAX1841EUB Shunts (JU1: 1-2, JU2: 2-3, JU4: 1-2, JU5: 1-2, H8: 1-2, H8: 9-10) PC board, MAX1258 EV kit DESCRIPTION
C1, C14, C19, C21
4
C2-C13, C15, C16, C23
15
C17
1
C18
1
C20, C22
2
-- --
6 1
C24, C25, C26
3
Quick Start
Required Equipment
Before you begin, you will need the following equipment: * Maxim MAX1258EVC16 (contains MAX1258EVKIT board and 68HC16MODULE-DIP) * DC power supply, +7V to +20VDC at 0.25A * Windows 95/98/2000/XP PC with an available serial (COM) port * 9-pin I/O extension cable
open. Jumper location JU3 is closed unless previously cut apart. See Tables 2-6. 2) Carefully connect the boards by aligning the 40-pin header of the MAX1258 EV kit with the 40-pin connector of the 68HC16MODULE-DIP module. Gently press them together. The two boards should be flush against one another. 3) Connect a +7V to +20V DC power source to the C module at the terminal block located next to the on/off switch, along the top edge of the C module. Observe the polarity marked on the board. 4) Connect a cable from the computer's serial port to the C module. If using a 9-pin serial port, use a straight-through, 9-pin, female-to-male cable. If the only available serial port uses a 25-pin connector, a standard 25-pin to 9-pin adapter is required. The EV kit software checks the modem status lines
Procedure
Do not turn on the power until all connections are made. 1) Ensure that JU1 is in the 5V position, JU2 is in the 1-2 position, and JU5 is closed. JU4 should be
2
_______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System
(CTS, DSR, DCD) to confirm that the correct port has been selected. 5) Install the evaluation software on your computer by running the INSTALL.EXE program on the floppy disk. The program files are copied and icons are created for them in the Windows Start Menu. 6) Turn on the power supply. 7) Start the MAX1258 program by opening its icon in the Start Menu. 8) The program prompts you to connect the C module and turn its power on. Slide SW1 to the ON position. Select the correct serial port, and click OK. The program automatically downloads its software to the module. 9) Apply an input signal to AIN0 and click Perform Action. Observe the readout on the screen. To perform the action repeatedly, check the every 200ms box. 10) To view a graph of the measurements, pull down the View menu and click Graph. 11) Bring up the DAC Outputs tab, select action 1111 cccc cccc 001x Power On Selected Channels, and click Perform Action. 12) Select action 1100 Write and Load OUT0-OUT7, set OUT1 code to 2048, and click Perform Action. Observe that the voltage on OUT0 is now midscale (2.048V, assuming VREF = 4.096V). 13) Bring up the GPIO Pins tab. Set GPIOA0 to High Output, set GPIOB0 to Low Output, set GPIOC3 to Input, and click Write Output Pins. Observe that the A0 pin is now logic high and the B0 pin is now logic low. 14) Connect GPIO pin C3 to logic high (A0) and click Read Input Pins. Observe that the software indicates that C3 is high. 15) Connect GPIO pin C3 to logic low (B0) and click Read Input Pins. Observe that the software indicates that C3 is low. The Action setting read single channel repeatedly requires making a selection under Repetition to determine how many times the selected channel should be measured. Use Averaging to summarize a series of measurements results on each selected channel as an arithmetic mean value. Repetition can be used together with Averaging to summarize a large number of measurement results as a small number of sample means. The Low-Level Interface Details panel shows the most recent low-level register write. A summary of what has been written to each register is available under the Low-level registers tab. The AIN14 and AIN15 channels are automatically skipped if their alternate functions are selected in the setup register. The evaluation software updates its display to show or hide these channels whenever the alternate functions are enabled or disabled. The Setup tab configures the alternate functions for the AIN14 and AIN15 pins, and also configures adjacent channels as differential input pairs. The Low-level registers tab summarizes the commands that create the active configuration. The Reset All Registers button resets these software-shadowed register values and sends the reset command to the MAX1258, optionally configuring slow mode and bandgap mode.
Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
DAC Outputs
The DAC Outputs tab in the main window controls the analog output pins. To power DAC channels prior to use, select action 1111 cccc cccc 001x Power On Selected Channels. Verify that the checkboxes are set and click Perform Action. Jumper JU2 defines the initial states of the DAC output pins. To reset all DAC outputs to zero, select action 0001 0... Reset all DACs to 000 (zero scale) and click Perform Action. To reset all DAC outputs to full scale, select action 0001 1... Reset all DACs to FFF (full scale) and click Perform Action. Note: At power-on the DAC expects an external reference on REF1. Refer to the MAX1258 data sheet. To write and load multiple DAC channels, select action 1100 Write and Load OUT0-OUT7, type the desired output code value (0 to 4095) into the OUT0 edit field, and click Perform Action. The voltage on the OUT0-OUT7 pins immediately changes to the new value.
Detailed Description of Software
The main window of the evaluation software configures the data converter and measures the analog inputs. Under Action, select a scanning sequence, repetitive conversions, or a single conversion. Each selected channel's measurement results are displayed in the corresponding Measurement Results field.
_______________________________________________________________________________________
3
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
To write a single DAC output (for example OUT5), select action 0110 Write OUT5. Type the desired output code value (0 to 4095) into the OUT5 edit field and click Perform Action. Unless jumper JU5 is closed (asserting the LDAC pin low), a separate load command is required to update the pin voltage from the input register. Load OUT5 by selecting action 1110 cccc cccc xxxx Load Selected Channels, checking the Load checkbox for channel 5, and clicking Perform Action. position. In the software's options menu, select reference = 2.500V.
Evaluating the MAX1057
The MAX1057 is the 3V, 10-bit version of the MAX1257. Request a free sample of the MAX1057BETM. Replace U1 with a MAX1057 and move the JU1 shunt to the 3V position. In the software's Options menu, select reference = 2.500V. The evaluation software expects 12 bits of data, but the MAX1057 only provides 10 bits of meaningful data. Because the most significant bits (MSBs) are aligned, the measurement code numbers reported by the software are four times the actual measurement code number. Reconstructed voltage values are unaffected. Adjust the graph window by selecting its Options menu and setting Sub-LSBs to 2.
GPIO Pins
The main window's GPIO Pins tab configures, writes, and reads the general-purpose digital input/output pins. Each GPIO pin has a drop-down combo box that configures High Output, Low Output, Input, or OpenDrain Pull-Down modes for that pin. Select output mode and click Write Output Pins. Read pins by clicking Read Input Pins.
Evaluating the MAX1058
The MAX1058 is the 10-bit version of the MAX1258. Request a free sample of the MAX1058BETM. Replace U1 with a MAX1058 and move the JU1 shunt to the 5V position. The evaluation software expects 12 bits of data, but the MAX1058 only provides 10 bits of meaningful data. Because the MSBs are aligned, the measurement code numbers reported by the software are four times the actual measurement code number. Reconstructed voltage values are unaffected. Adjust the graph window by selecting its Options menu and setting Sub-LSBs to 2.
Sampling
Measurement data can be sampled in external clock mode. From the Setup tab, set Clock Mode to 0111xxxx ext clock. Then, return to the Measurement tab and click Get Samples.
Graph Window
To view recently measured data, drop down the View menu and choose graph. Data can be viewed as a time sequence plot, a histogram plot, or as a table of raw numbers (see Figure 6). See Table 1 for available graph commands.
Diagnostics Window
The diagnostics window is used for factory testing prior to shipping the evaluation kit. It is not intended for customer use.
Using an External Reference
All ADCs or DACs need a reference to perform conversions. A single-ended external reference can be applied for the MAX1258 DAC while using the internal reference for the ADC. This is the default mode. With the power off, connect the DAC external reference to REF1. Then power the system and run the evaluation software. Under the Setup tab, set the Reference Input to 01xx10xx Pin 48=AIN14, ADCREF=Internal, DACREF=REF1. Connect on-board REF1 bypass capacitor C14 by installing a shunt on JU4. Whenever the software calculates a voltage that corresponds to a DAC code value, that calculation depends upon the user-provided REF1 pin voltage value. To use the internal reference for both the ADC and the DAC, bring up the Setup tab and set Reference Input to 01xx00xx Pin 48=AIN14, ADCREF=Internal, DACREF=Internal. Leave JU4 open when using the internal reference. Independent single-ended references can be applied for both the DAC and the ADC. With the power off, connect the DAC external reference to REF1 and connect the ADC external reference to REF2. Then power the
Detailed Description of Hardware
The MAX1258 device under test (U1) offers a multichannel 12-bit ADC, a temperature sensor, an octal 12bit DAC, and configurable GPIOs. Resistors R1-R16 and capacitors C1-C16 form single-pole lowpass antialiasing filters for each input. Capacitor C17 provides power-supply bypassing for U1. See Figure 7 and refer to the MAX1258 data sheet. The EV kit includes a MAX1615 3V/5V linear regulator (U2) and a set of MAX1840/MAX1841 level shifters (U3 and U4) to support using the 3V MAX1257 with the 5V C.
Evaluating the MAX1257
The MAX1257 is the 3V version of the MAX1258. Request a free sample of the MAX1257BETM. Replace U1 with a MAX1257 and move the JU1 shunt to the 3V
4
_______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System
system and run the evaluation software. Under the Setup tab, set the Reference Input to 01xx01xx Pin 48=REF2, ADCREF=REF2, DACREF=REF1. Connect on-board REF1 bypass capacitor C14 by installing a shunt on JU4. Whenever the software calculates a voltage that corresponds to a DAC code value, that calculation depends upon the user-provided REF1 pin voltage value. Whenever the software calculates a voltage that corresponds to an ADC code value, that calculation depends upon the user-provided REF2 pin voltage value. A single-ended external reference can be applied for the DAC while a differential external reference is applied to the ADC. With the power off, connect the DAC external reference to REF1, and connect the ADC external reference between REF1 and REF2 such that REF1 > REF2. Then power the system and run the evaluation software. Under the Setup tab, set the Reference Input to 01xx11xx Pin 48=REF2, ADCREF=REF1-REF2, DACREF=REF1. Connect on-board REF1 bypass capacitor C14 by installing a shunt on JU4.
Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
Table 1. Graph Tool Buttons
TOOL FUNCTION Show the entire available input range. Expand the graph data to fill the window. Move the view left or right. Move the view up or down. Expand or contract the x-axis. Expand or contract the y-axis. Load data from a file. Save data to a file. Option to write a header line when saving data. Option to write line numbers when saving data. View code vs. time plot. View histogram plot (cumulative frequency of each code). View table. Show minimum in tabular view. Show maximum in tabular view. Show span in tabular view. Span = maximum - minimum. Show number of samples in tabular view. Show sum of the samples in tabular view. Show sum of the squares of the samples in tabular view. Show arithmetic mean in tabular view: TOOL FUNCTION Show standard deviation in tabular view:
S tandard deviation =
n x - x n n (n -1)n
2
()
2
Show root of the mean of the squares (RMS) in tabular view: x2 RMS = n
()
Channel 0 enable. Channel 1 enable. Channel 2 enable. Channel 3 enable. Channel 4 enable. Channel 5 enable. Channel 6 enable. Channel 7 enable. Channel 8 enable. Channel 9 enable. Channel 10 enable. Channel 11 enable. Channel 12 enable. Channel 13 enable.
Mean =
( x ) n
Channel 14 enable. Channel 15 enable. Channel 16 enable (temperature).
_______________________________________________________________________________________
5
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
Table 2. Jumper JU1 (VDD Voltage Selection)
SHUNT POSITION 1-2* 2-3 Open VDD VOLTAGE 5V 3V Unspecified FUNCTION Normal operation with U1 = MAX1058 or MAX1258. Normal operation with U1 = MAX1057 or MAX1257. Do not operate kit with JU1 open.
Table 5. Jumper JU4 (REF1 Bypass)
SHUNT POSITION Open Closed* REF1 BYPASS CAPACITOR User-provided C14 bypasses REF1 FUNCTION Leave JU4 open when using the internal reference. Close JU4 when using an external reference.
*Default configuration.
*Default configuration.
Table 6. Jumper JU5 (LDAC)
SHUNT POSITION Open Closed* LDAC STATE High Low FUNCTION Update DAC outputs by sending command through SPI. DAC input registers are transferred to DAC output registers.
Table 3. Jumper JU2 (RES_SEL)
SHUNT POSITION RES_SEL STATE FUNCTION When power is first applied, the DAC outputs are pulled to REF1 through internal 100k resistors. All DAC input registers are set to 0xFFF. When power is first applied, the DAC outputs are pulled to AGND through internal 100k resistors. All DAC input registers are set to 0x000. Do not power the kit with JU2 open.
1-2
High
*Default configuration.
2-3*
Low
Whenever the software calculates a voltage that corresponds to a DAC code value, that calculation depends upon the user-provided REF1 pin voltage and REF2 pin voltage values.
Open
Undriven
Troubleshooting
Problem: No output measurement. System seems to report zero voltage or fails to make a measurement. Solution: Check VDD supply voltage. Check the reference voltage using a digital voltmeter. Use an oscilloscope to verify that the conversion-start signal is being strobed. Problem: Measurements are erratic, unstable, or inaccurate. Solution: Check the reference voltage using a digital voltmeter. Use an oscilloscope to check for noise. When probing for noise, keep the oscilloscope ground return lead as short as possible, preferably less than 0.5in (10 mm). Problem: Unacceptable errors when measuring a transducer. Solution: Although most signal sources can be connected directly to the analog inputs of the MAX1258, some high-impedance signal sources (greater than 300) may require an input buffer. Check for settling errors by increasing the acquisition time (internal clock mode 01). If necessary, use a MAX4430 to buffer high-impedance signal sources. Refer to the MAX1258 data sheet.
*Default configuration.
Table 4. Optional Jumper JU3 (AIN15 Alternate Function)
JU3 STATE U1 PIN 1 CONNECTION Connected to C module J1 pin 29 (through level shifter). Connected to AIN15 pad. FUNCTION U1 pin 1 = CNVST conversion start command. Leave AIN15 pad unconnected. U1 pin 1 = AIN15 analog input. Connect signal source to AIN15 pad.
Closed*
Open
*Default configuration.
6
_______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
Figure 1. MAX1258 Evaluation Software's Main Window--Configures the Data Converter and Measures the Analog Inputs
_______________________________________________________________________________________
7
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
Figure 2. Setup Tab of Main Window--Configures the Alternate Functions for AIN14 and AIN15, and also Configures Adjacent Channels as Differential Input Pairs
8
_______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
Figure 3. Low-Level Registers Tab of Main Window--Summarizes the Commands that Create the Active Configuration
_______________________________________________________________________________________
9
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
Figure 4. DAC Outputs Tab of Main Window--Controls the Analog Output Pins
10
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
Figure 5. GPIO Pins Tab--Configures, Writes, and Reads the Digital GPIO Pins
______________________________________________________________________________________
11
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
Figure 6. Real-Time Data and Sampled Data Graphs--Display Data as a Time Sequence, Histogram, or Table
12
______________________________________________________________________________________
AIN14
AIN13
AIN12
AIN11
AIN10
AIN9
AIN8
AIN7
AIN6
AIN5
AIN4
AIN3
AIN14 AIN12 AIN8 C6 0.01F C7 0.01F C10 0.01F C12 0.01F C11 0.01F C8 0.01F C9 0.01F AIN7 AIN5 AIN3 AIN4 C3 0.01F C4 0.01F C5 0.01F C1 0.1F C2 0.01F
R1 10 AIN13 R7 10 R10 10 R12 10 R11 10
R2 10 R4 10 AIN10
R3 10 AIN11
R5 10 AIN9
R6 10
R8 10 AIN6
R9 10
40 38 AIN4 AIN3 AIN2 36 C13 R13 0.01F 10 AIN2 REF1 AIN2 AIN6 AIN5
CNVST
48 REF2/AIN14 44 AIN10 41 AIN7 42 AIN8
47 AIN13
46 AIN12 45 AIN11 43 AIN9 39
37
1 CNVST/AIN15 C23 0.01F 2 GPIOA0 REF1 JU4 3 GPIOA1 AIN1 4 EOC AIN0 5 GPIOA2 AIN0 33 C16 R16 0.01F 10 6 GPIOA3 U1 GPIOC3 32 AIN0 GPIOC3 H7 H7-1 GPIOC2 31 GPIOC2 H7-3 GPIOC1 DGND GPIOC1 9 DOUT GPIOC0 10 SCLK 30 H7-5 GPIOC0 H7-7 29 RES_SEL 1 RES_SEL 28 CS 11 DIN LDAC 12 OUT0 25 GPIOB2 19 20 GPIOB3 21 OUT4 22 OUT5 23 OUT6 24 OUT7 26 JU5 OUT7 H8-9 H8-10 27 LDAC CS JU2 2 3 R18 DV DD 100k AVDD H8 H8-1 H8-2 H7-8 H7-6 H7-4 H7-2 C15 R15 0.01F 10 AIN1 34 AIN1 C14 0.1F R14 10 REF1 35
AIN15
R17 10
GPIDA0
H5
GPIDA1
H5-8 H5-7
H5-6 H5-5
EOC
H6
MAX1258 Evaluation Kit/Evaluation System
Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
______________________________________________________________________________________
MAX1258
7 DVDD C21 0.1F 8 R19 10k H8-3 H8-4 R20 510 H8-5 H8-6 R21 2k H8-7 H8-8 C17 470pF OUT1 OUT3 15 16 17 18 C19 0.1F AVDD OUT0 OUT3 OUT1 OUT2 GPIOB0 GPIOB1 C20 1F GPIOB2 GPIOB3 OUT4 OUT5 OUT6 GPIOB0 GPIOB1 13 14 OUT2 AVDD AGND C18 100pF H6-8 H6-7 H6-6 H6-5 H6-4 H6-3 H6-2 H6-1 OUT0 OUT1 OUT2 OUT3 OUT4 OUT5 OUT6 OUT7
Figure 7a. MAX1258 EV Kit Schematic (sheet 1 of 2)
H5-4 H5-3
GPIDA2
H5-2 H5-1
GPIDA3
DVDD
C22 1F
DOUT
SCLK
DIN
13
Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
H4 1 H4-12 C25 10F 2 GND U2 TB1-2 DVDD 1 AVDD R22 DVDD 10 (FB) 3 OUT 3 C24 10F R23 10 1 DATA DVDD 2 DVCC VCC 9 I/O 10 2 4 JU1 J1-9 J1-10 J1-11 J1-12 J1-13 J1-14 J1-15 J1-16 J1-17 H3 J1-18 OUT7 J1-19 J1-20 J1-21 J1-22 J1-23 J1-24 J1-25 J1-26 J1-27 J1-28 J1-30 N.C. N.C. N.C. N.C. N.C. J1-40 J1-39 J1-33 J1-34 J1-32 J1-29 N.C. J1-35 N.C. N.C. 8 N.C. N.C. N.C. 9 VCC DVCC 10 I/O DATA 2 1 JU3 CNVST CLK 7 N.C. J1-31 6 GND SHDN 5 DVDD N.C. N.C. N.C. J1-36 LDAC CS RES_SEL GPIOC0 GPIOC1 GPIOC2 GPIOC3 AIN0 AIN1 REF1 AIN2 N.C. J1-37 4 5 RST RIN SHDN GND 6 J1-8 H3-1 H3-2 H3-3 H3-4 H3-5 H3-6 H3-7 H3-8 H3-9 H3-10 H3-11 H3-12 N.C. N.C. J1-7 CLK 8 SCLK N.C. J1-38 N.C. 3 N.C. J1-4 U3 CIN N.C. J1-3 N.C. J1-2 N.C. J1-1 N.C. J1-5 N.C. J1-6 C26 10F SHDN TB1-1 5 H4-11 H4-10 AIN12 AIN13 AIN14 IN TB1
Figure 7b. MAX1258 EV Kit Schematic (sheet 2 of 2)
MAX1615
H4-9 H4-8 H4-7 H4-6 H4-5 H4-4 H4-3 H4-2 H4-1 AIN3 AIN4 AIN5 AIN6 AIN7 AIN8 AIN9 AIN10 AIN11 CS
MAX1258 Evaluation Kit/Evaluation System
14
MAX1840
7 DIN RST U4 RIN 4 EOC
H1
H1-1
CNVST
H1-2
GPIOA0
H1-3
GPIOA1
H1-4
EOC
H1-5
GPIOA2
H1-6
GPIOA3
H1-7
DVDD
H1-8
H1-9
DOUT
H1-10
SCLK
H1-11
DIN
H1-12
OUT0
H2
H2-12
OUT6
H2-11
OUT5
H2-10
OUT4
H2-9
GPIOB3
H2-8
GPIOB2
H2-7
AVDD
H2-6
H2-5
GPIOB1
MAX1840
CIN 3 DVDD DOUT
H2-4
GPIOB0
______________________________________________________________________________________
H2-3
OUT3
H2-2
OUT2
H2-1
OUT1
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
Figure 8. MAX1258 EV Kit Component Placement Guide--Component Side
Figure 9. MAX1258 EV Kit PC Board Layout--Component Side ______________________________________________________________________________________ 15
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
Figure 10. MAX1258 EV Kit PC Board Layout--Solder Side
16
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 1 MAX1258EV listing1
06/01/04
1
// Drv1258.h // MAX1258-specific driver. // mku 04/07/2004 // (C) 2004 Maxim Integrated Products //-------------------------------------------------// Revision history (latest at top): // ======================================== // __/__/2004: Initial Release as MAX1258 Version 1.0 // ======================================== //--------------------------------------------------------------------------#ifndef DRV1258H #define DRV1258H //--------------------------------------------------------------------------//--------------------------------------------------------------------------// The following interface protocols must be provided by // the appropriate low-level interface code. // /* SPI interface: ** byte_count = transfer length ** mosi[] = array of master-out, slave-in data bytes ** miso_buf[] = receive buffer for master-in, slave-out data bytes ** ** 04/07/2004: master-in slave-out data from MAX1258 is delayed one clock cycle. ** When instructed to transfer n bytes, the hardware must generate ** n * 8 clock pulses. However, the first bit of miso_buf[] must be sampled ** concurrent with the SECOND bit of mosi[]. ** The final bit of miso_buf[] does not get a clock pulse, instead the ** final state of the MAX1258 DOUT pin is sampled prior to negating CS. */ extern bool SPI_Transfer_MISO_Delayed(int byte_count, const unsigned __int8 mosi[], unsigned __int8 miso_buf[]); // Read the state of the EOC pin until the pin is low // or until a platform-specific timeout expires. // On Exit: // Return value = true if EOC pin is low // Return value = false if timeout expires and EOC is sitll high // extern bool Wait_MAX1258_EOC_Low(void); // Pulse the CONV pin low and then high. // extern void Pulse_MAX1258_CONV(void); // Set acquisition time (when in clock mode 01) // DelayString is of the form: // 200us // 500us // 1ms // 2ms // 5ms // 10ms // 20ms // 50ms // 100ms // 200ms // 500ms // 1s extern bool Set_Acquisition_Time(const char* DelayString);
Listing 1 (Sheet 1 of 10)
______________________________________________________________________________________
17
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 1 MAX1258EV listing1
06/01/04
2
//-------------------------------------------------// MAX1258 Conversion register // 1 x x x x x x x #define MAX1258_CONV 0x80 // // Power-on state: 1000 0000 #define MAX1258_CONV_POR 0x80 // // Channel Selection #define MAX1258_CONV_AIN00 0x80 #define MAX1258_CONV_AIN01 0x88 #define MAX1258_CONV_AIN02 0x90 #define MAX1258_CONV_AIN03 0x98 #define MAX1258_CONV_AIN04 0xA0 #define MAX1258_CONV_AIN05 0xA8 #define MAX1258_CONV_AIN06 0xB0 #define MAX1258_CONV_AIN07 0xB8 #define MAX1258_CONV_AIN08 0xC0 #define MAX1258_CONV_AIN09 0xC8 #define MAX1258_CONV_AIN10 0xD0 #define MAX1258_CONV_AIN11 0xD8 #define MAX1258_CONV_AIN12 0xE0 #define MAX1258_CONV_AIN13 0xE8 #define MAX1258_CONV_AIN14 0xF0 #define MAX1258_CONV_AIN15 0xF8 // // Actions #define MAX1258_CONV_SCAN_00_N #define MAX1258_CONV_SCAN_T_00_N #define MAX1258_CONV_SCAN_N_15 #define MAX1258_CONV_SCAN_T_N_15 #define MAX1258_CONV_SINGLE_REPEAT #define MAX1258_CONV_SINGLE_READ // #define MAX1258_ACTION_MASK
/* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /*
10000xxx 10001xxx 10010xxx 10011xxx 10100xxx 10101xxx 10110xxx 10111xxx 11000xxx 11001xxx 11010xxx 11011xxx 11100xxx 11101xxx 11110xxx 11111xxx
AIN0 */ AIN1 */ AIN2 */ AIN3 */ AIN4 */ AIN5 */ AIN6 */ AIN7 */ AIN8 */ AIN9 */ AIN10 */ AIN11 */ AIN12 */ AIN13 */ AIN14 */ AIN15 */
0x80 0x81 0x82 0x83 0x84 0x86 0x87
/* /* /* /* /* /*
1xxxx000 1xxxx001 1xxxx010 1xxxx011 1xxxx10x 1xxxx11x
Scan Scan Scan Scan Read Read
0,1,2,...N */ T,0,1,2,..N */ N,N+1,...,15 */ T,N,N+1,...,15 */ repeatedly */ once */
/* 1xxxx111 bits to test*/
//-------------------------------------------------// MAX1258 Setup register // 0 1 x x x x 0 0 // // Setup register may optionally be followed by // one of the the differential configuration registers. // 01xxxx10 followed by a second byte, selecting Unipolar-Differential inputs // 01xxxx11 followed by a second byte, selecting Bipolar-Differential inputs #define MAX1258_SETUP 0x40 /* 01xxxx00 no additional bytes */ #define MAX1258_SETUP_UNIDIFF 0x42 /* 01xxxx10 followed by another byte */ #define MAX1258_SETUP_BIPDIFF 0x43 /* 01xxxx11 followed by another byte */ // // Power-on state: 0110 0000 #define MAX1258_SETUP_POR 0x60 // // Clock Mode // 0100xxxx pin16=CNVST, Int clock, Triggered by CNVST pulse // 0101xxxx pin16=CNVST, Int clock, Triggered by CNVST pulses, custom Tacq // 0110xxxx pin16=AIN15, Int clock, Triggered by conversion register write // 0111xxxx pin16=AIN15, Ext clock, Triggered by conversion register write #define MAX1258_SETUP_INTCLK_CNVST 0x40 /* 0100xxxx CNVST */ #define MAX1258_SETUP_INTCLK_CNVST_TACQ 0x50 /* 0101xxxx CNVST */ #define MAX1258_SETUP_INTCLK 0x60 /* 0110xxxx AIN15 */ #define MAX1258_SETUP_EXTCLK 0x70 /* 0111xxxx AIN15 */ // // Reference Voltage // MAX1258: 01xx00xx Pin 48=AIN14, ADCREF=Internal, DACREF=Internal // MAX1258: 01xx01xx Pin 48=REF2, ADCREF=REF2, DACREF=REF1
Listing 1 (Sheet 2 of 10)
18
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 1 MAX1258EV listing1
06/01/04
3
// MAX1258: 01xx10xx Pin 48=AIN14, ADCREF=Internal, DACREF=REF1 // MAX1258: 01xx11xx Pin 48=REF2, ADCREF=REF1-REF2, DACREF=REF1 #define MAX1258_SETUP_REF00 0x40 /* 01xx00xx */ #define MAX1258_SETUP_INTREF_SLEEP 0x40 /* 01xx00xx #define MAX1258_SETUP_REF01 0x44 /* 01xx01xx */ #define MAX1258_SETUP_EXTREF 0x44 /* 01xx01xx #define MAX1258_SETUP_REF10 0x48 /* 01xx10xx */ #define MAX1258_SETUP_INTREF_ACTIVE 0x48 /* 01xx10xx #define MAX1258_SETUP_REF11 0x4C /* 01xx11xx */ #define MAX1258_SETUP_EXTREF_DIFF 0x4C /* 01xx11xx // // // MAX1258 Unipolar-Differential input pairs // Byte Following MAX1258_SETUP_UNIDIFF // 0 1 x x x x 1 0 unidiff // // Power-on state: 0110 0010 0000 0000 #define MAX1258_SETUP_UNIDIF_POR 0x00 // #define MAX1258_SETUP_UNIDIF0001 0x80 #define MAX1258_SETUP_UNIDIF0203 0x40 #define MAX1258_SETUP_UNIDIF0405 0x20 #define MAX1258_SETUP_UNIDIF0607 0x10 #define MAX1258_SETUP_UNIDIF0809 0x08 #define MAX1258_SETUP_UNIDIF1011 0x04 #define MAX1258_SETUP_UNIDIF1213 0x02 #define MAX1258_SETUP_UNIDIF1415 0x01 // // MAX1258 Bipolar-Differential input pairs // Byte Following MAX1258_SETUP_BIPDIFF // 0 1 x x x x 1 1 bipdiff // // Power-on state: 0110 0011 0000 0000 #define MAX1258_SETUP_BIPDIF_POR 0x00 // #define MAX1258_SETUP_BIPDIF0001 0x80 #define MAX1258_SETUP_BIPDIF0203 0x40 #define MAX1258_SETUP_BIPDIF0405 0x20 #define MAX1258_SETUP_BIPDIF0607 0x10 #define MAX1258_SETUP_BIPDIF0809 0x08 #define MAX1258_SETUP_BIPDIF1011 0x04 #define MAX1258_SETUP_BIPDIF1213 0x02 #define MAX1258_SETUP_BIPDIF1415 0x01 //-------------------------------------------------// MAX1258 Averaging register // 0 0 1 x x x x x // // Power-on state: 0010 0000 #define MAX1258_AVERAGE_POR 0x20 // // Averaging // 001000xx One measurement result (no averaging) // 001100xx Mean of 4 measurement results // 001101xx Mean of 8 measurement results // 001110xx Mean of 16 measurement results // 001111xx Mean of 32 measurement results #define MAX1258_AVERAGE_1 0x20 #define MAX1258_AVERAGE_4 0x30 #define MAX1258_AVERAGE_8 0x34 #define MAX1258_AVERAGE_16 0x38 #define MAX1258_AVERAGE_32 0x3C // // Repeat Count
Pin 48=AIN14 */ Pin 48=REF2 */ Pin 48=AIN14 */ Pin 48=REF2 */
/* /* /* /* /*
001000xx 001100xx 001101xx 001110xx 001111xx
No averaging */ Mean of 4 measurements */ Mean of 8 measurements */ Mean of 16 measurements */ Mean of 32 measurements */
Listing 1 (Sheet 3 of 10)
______________________________________________________________________________________
19
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 1 MAX1258EV listing1 06/01/04 4
// Enabled by MAX1258_CONV_SINGLE_REPEAT 1xxxx10x // Internal clock modes only #define MAX1258_REPEAT_4 0x20 /* 001xxx00 #define MAX1258_REPEAT_8 0x21 /* 001xxx01 #define MAX1258_REPEAT_12 0x22 /* 001xxx10 #define MAX1258_REPEAT_16 0x23 /* 001xxx11
4 times */ 8 times */ 12 times */ 16 times */
//-------------------------------------------------// MAX1258 Reset register (reset command) // 0 0 0 0 1 // // Reset all registers to their power-on default states #define MAX1258_RESET_ALL 0x0C /* 000011xx Reset All Registers */ // // "Slow" mode #define MAX1258_RESET_SLOW 0x0A /* 0000101x "Slow" mode */ // // Force bandgap and bias block to be turned on (and clear FIFO) #define MAX1258_RESET_FBGON 0x09 /* 000010x1 Force bandgap on */ //-------------------------------------------------// MAX1258 GPIO (General-purpose Input/Output) // // MAX1220 has four GPIO pins // MAX1221 has four GPIO pins // MAX1257/MAX1258 have twelve GPIO pins // // To configure a GPIO pin for OUTPUT, // set the corresponding bit 1 in the configuration register. // Pin state is controlled by a bit in the write-data register. // // To configure a GPIO pin for INPUT, // set the corresponding bit 0 in the configuration register // and set the corresponding bit 1 in the write-data register. // Pin state is returned in a bit in the read-data register. // //-------------------------------------------------// MAX1258 GPIO Configuration register // 0 0 0 0 0 0 1 1 // #define MAX1258_GPIO_CONFIG 0x03 /* 00000011 next 16 bits = GPIO configuration data */ #define MAX1220_GPIO_CONFIG 0x03 /* 00000011 next 8 bits = GPIO configuration data */ //-------------------------------------------------// MAX1258 GPIO Write register // 0 0 0 0 0 0 1 0 // #define MAX1258_GPIO_WRITE 0x02 /* 00000010 next 16 bits = GPIO write data */ #define MAX1220_GPIO_WRITE 0x02 /* 00000010 next 8 bits = GPIO write data */ //-------------------------------------------------// MAX1258 GPIO Read register // 0 0 0 0 0 0 0 1 // #define MAX1258_GPIO_READ 0x01 /* 00000001 next 16 bits = GPIO read data */ #define MAX1220_GPIO_READ 0x01 /* 00000001 next 8 bits = GPIO read data */ //-------------------------------------------------// MAX1257/MAX1258 GPIO pin WRITE/CONGIFURE mask bits // // X X X X // // MAX1257/MAX1258 GPIO pin READ mask bits
Listing 1 (Sheet 4 of 10)
20
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 1 MAX1258EV listing1
06/01/04
5
// X X X X // // // For READ, the GPIOB3..GPIOB0 pins migrate to the third byte. // #define MAX1258_GPIO_WRC3 0x8000 /* 1xxxxxxx xxxxxxxx */ #define MAX1258_GPIO_WRC2 0x4000 /* x1xxxxxx xxxxxxxx */ #define MAX1258_GPIO_WRC1 0x2000 /* xx1xxxxx xxxxxxxx */ #define MAX1258_GPIO_WRC0 0x1000 /* xxx1xxxx xxxxxxxx */ #define MAX1258_GPIO_WRB3 0x0800 /* xxxx1xxx xxxxxxxx */ #define MAX1258_GPIO_WRB2 0x0400 /* xxxxx1xx xxxxxxxx */ #define MAX1258_GPIO_WRB1 0x0200 /* xxxxxx1x xxxxxxxx */ #define MAX1258_GPIO_WRB0 0x0100 /* xxxxxxx1 xxxxxxxx */ #define MAX1258_GPIO_WRA3 0x0080 /* xxxxxxxx 1xxxxxxx */ #define MAX1258_GPIO_WRA2 0x0040 /* xxxxxxxx x1xxxxxx */ #define MAX1258_GPIO_WRA1 0x0020 /* xxxxxxxx xx1xxxxx */ #define MAX1258_GPIO_WRA0 0x0010 /* xxxxxxxx xxx1xxxx */ // #define MAX1258_GPIO_RDC3 0x0800 /* xxxx1xxx xxxxxxxx */ #define MAX1258_GPIO_RDC2 0x0400 /* xxxxx1xx xxxxxxxx */ #define MAX1258_GPIO_RDC1 0x0200 /* xxxxxx1x xxxxxxxx */ #define MAX1258_GPIO_RDC0 0x0100 /* xxxxxxx1 xxxxxxxx */ #define MAX1258_GPIO_RDB3 0x0080 /* xxxxxxxx 1xxxxxxx */ #define MAX1258_GPIO_RDB2 0x0040 /* xxxxxxxx x1xxxxxx */ #define MAX1258_GPIO_RDB1 0x0020 /* xxxxxxxx xx1xxxxx */ #define MAX1258_GPIO_RDB0 0x0010 /* xxxxxxxx xxx1xxxx */ #define MAX1258_GPIO_RDA3 0x0008 /* xxxxxxxx xxxx1xxx */ #define MAX1258_GPIO_RDA2 0x0004 /* xxxxxxxx xxxxx1xx */ #define MAX1258_GPIO_RDA1 0x0002 /* xxxxxxxx xxxxxx1x */ #define MAX1258_GPIO_RDA0 0x0001 /* xxxxxxxx xxxxxxx1 */ // //-------------------------------------------------// GPIO pin masks for all GPIO commands // MAX1220/MAX1221 GPIO pin WRITE/CONGIFURE mask bits // X X X X // // MAX1220/MAX1221 GPIO pin READ mask bits // X X X X // #define MAX1220_GPIO_WRC1 0x80 /* 1xxxxxxx */ #define MAX1220_GPIO_WRC0 0x40 /* x1xxxxxx */ #define MAX1220_GPIO_WRA1 0x20 /* xx1xxxxx */ #define MAX1220_GPIO_WRA0 0x10 /* xxx1xxxx */ // #define MAX1220_GPIO_RDC1 0x08 /* xxxx1xxx */ #define MAX1220_GPIO_RDC0 0x04 /* xxxxx1xx */ #define MAX1220_GPIO_RDA1 0x02 /* xxxxxx1x */ #define MAX1220_GPIO_RDA0 0x01 /* xxxxxxx1 */ // //--------------------------------------------------
//-------------------------------------------------// MAX1258 DAC Select register // 0 0 0 1 x x x x // // // // This 8-bit preamble is followed by 4-bit command and 12-bit data, // described in the next table. // #define MAX1258_DAC 0x10 /* 0001xxxx next 16 bits = DAC command and data */ // // Because the DAC requires sending 3 bytes, the following constants // use the prefix MAX1258_DACc_ for the second byte (command byte)
Listing 1 (Sheet 5 of 10)
______________________________________________________________________________________
21
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 1 MAX1258EV listing1 06/01/04 6
// and the prefix MAX1258_DACd_ for the third byte (data byte). // // A complete DAC command requires a 3-byte SPI transfer. // //-------------------------------------------------// MAX1258 DAC commands // // #define MAX1258_DACc_NOP 0x00 /* 0000 no operation */ // // DAC reset commands // 0 0 0 1 0 x x x x x x x x x x x // reset all input and DAC registers to 0x000 // 0 0 0 1 1 x x x x x x x x x x x // reset all input and DAC registers to 0xFFF #define MAX1258_DACc_RESET_000 0x10 /* 00010xxx reset to 0x000 */ #define MAX1258_DACc_RESET_FFF 0x18 /* 00011xxx reset to 0xFFF */ // // DAC input register write commands (not updating DAC outputs) #define MAX1258_DACc_WRITE1 0x20 /* 0010 write input register 1 */ #define MAX1258_DACc_WRITE2 0x30 /* 0011 write input register 2 */ #define MAX1258_DACc_WRITE3 0x40 /* 0100 write input register 3 */ #define MAX1258_DACc_WRITE4 0x50 /* 0101 write input register 4 */ #define MAX1258_DACc_WRITE5 0x60 /* 0110 write input register 5 */ #define MAX1258_DACc_WRITE6 0x70 /* 0111 write input register 6 */ #define MAX1258_DACc_WRITE7 0x80 /* 1000 write input register 7 */ #define MAX1258_DACc_WRITE8 0x90 /* 1001 write input register 8 */ // // DAC input register and DAC write-through commands (updating DAC outputs) #define MAX1258_DACc_WRITE14LOAD 0xA0 /* 1010 write input registers 1-4 and DAC registers 1-4 */ #define MAX1258_DACc_WRITE58LOAD 0xB0 /* 1011 write input registers 5-8 and DAC registers 5-8 */ #define MAX1258_DACc_WRITE18LOAD 0xC0 /* 1100 write input registers 1-8 and DAC registers 1-8 */ // // DAC multiple input register write commands (not updating DAC outputs) #define MAX1258_DACc_WRITE18 0xD0 /* 1101 write input registers 1-8 */ // // DAC load commands // 1 1 1 0 x x x x x x x 1 x x x x // load DAC 1 from input register 1 // 1 1 1 0 x x x x x x 1 x x x x x // load DAC 2 from input register 2 // 1 1 1 0 x x x x x 1 x x x x x x // load DAC 3 from input register 3 // 1 1 1 0 x x x x 1 x x x x x x x // load DAC 4 from input register 4 // 1 1 1 0 x x x 1 x x x x x x x x // load DAC 5 from input register 5 // 1 1 1 0 x x 1 x x x x x x x x x // load DAC 6 from input register 6 // 1 1 1 0 x 1 x x x x x x x x x x // load DAC 7 from input register 7 // 1 1 1 0 1 x x x x x x x x x x x // load DAC 8 from input register 8 #define MAX1258_DACc_LOAD 0xE0 /* 1110 load DAC registers from input registers, masked... */ #define MAX1258_DACc_CH8 0x08 /* xxxx10000000xxxx DAC 8 */ #define MAX1258_DACc_CH7 0x04 /* xxxx01000000xxxx DAC 7 */ #define MAX1258_DACc_CH6 0x02 /* xxxx00100000xxxx DAC 6 */ #define MAX1258_DACc_CH5 0x01 /* xxxx00010000xxxx DAC 5 */ #define MAX1258_DACd_CH4 0x80 /* xxxx00001000xxxx DAC 4 */ #define MAX1258_DACd_CH3 0x40 /* xxxx00000100xxxx DAC 3 */ #define MAX1258_DACd_CH2 0x20 /* xxxx00000010xxxx DAC 2 */ #define MAX1258_DACd_CH1 0x10 /* xxxx00000001xxxx DAC 1 */ #define MAX1258_DACd_CH1234 0xF0 /* xxxx00001111xxxx DAC 1..4 */ #define MAX1258_DACc_CH5678 0x0F /* xxxx11110000xxxx DAC 5..8 */ // //-------------------------------------------------// DAC Power-up and Power-down commands // All of these power-up/power-down commands operate on individual DAC buffers. // #define MAX1258_DACc_PWR 0xF0 /* 1111 power-up or power-down DAC channels*/
Listing 1 (Sheet 6 of 10)
22
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 1 MAX1258EV listing1
06/01/04
7
// // DAC power-up/power-down channel select mask bits: // 1 1 1 1 x x x x // (note: 0 = no change in DAC power-on state) // // DAC power-up/power-down command bits: // 1 1 1 1 d d d d d d d d 0 0 1 x // power up selected DAC buffers // 1 1 1 1 d d d d d d d d 0 1 0 x // power off selected DAC buffers, high impedance output // 1 1 1 1 d d d d d d d d 1 0 0 x // power off selected DAC buffers, 1kohm to AGND // 1 1 1 1 d d d d d d d d 0 0 0 x // power off selected DAC buffers, 100kohm to AGND // 1 1 1 1 d d d d d d d d 1 1 1 x // power off selected DAC buffers, 100kohm to V(REF1) #define MAX1258_DACd_PWR_ON 0x02 /* d4d3d2d1 001x power channels */ #define MAX1258_DACd_PWR_OFF 0x04 /* d4d3d2d1 010x power impedance */ #define MAX1258_DACd_PWR_OFF_1K_AGND 0x08 /* d4d3d2d1 100x power AGND */ #define MAX1258_DACd_PWR_OFF_100K_AGND 0x00 /* d4d3d2d1 000x power AGND */ #define MAX1258_DACd_PWR_OFF_100K_VREF 0x0F /* d4d3d2d1 111x power V(REF1) */
ON selected OFF, high OFF, 1kohm to OFF, 100kohm to OFF, 100kohm to
//-------------------------------------------------// Enumerated type defining the meaning of each of the // MAX1258's FIFO data slots. typedef enum { // // Unused FIFO slot; meaningless data. UNDEFINED = 0, // // Temperature measurement. // The scan modes always place temperature data // at the head of the FIFO. TEMPERATURE, // // Single-ended unipolar analog inputs. // Code 0x0000 = minimum voltage // Code 0x0FFF = maximum voltage // Note that AIN14 and AIN15 pins have optional alternate functions. UNIAIN00, UNIAIN01, UNIAIN02, UNIAIN03, UNIAIN04, UNIAIN05, UNIAIN06, UNIAIN07, UNIAIN08, UNIAIN09, UNIAIN10, UNIAIN11, UNIAIN12, UNIAIN13, UNIAIN14, UNIAIN15, // // Unipolar differential input pairs. // Code 0x0000 = minimum voltage // Code 0x0FFF = maximum voltage UNIDIF0001, UNIDIF0203, UNIDIF0405, UNIDIF0607, UNIDIF0809, UNIDIF1011, UNIDIF1213, UNIDIF1415, // // Bipolar differential input pairs. // Code 0x07FF = maximum voltage // Code 0x0000 = zero volts // Code 0x0800 = minimum voltage BIPDIF0001, BIPDIF0203, BIPDIF0405, BIPDIF0607, BIPDIF0809, BIPDIF1011, BIPDIF1213, BIPDIF1415, // NUM_FIFO_ENTRY_TYPES } MAX1258_fifo_entry_t; //-------------------------------------------------// Enumerated type defining each pair of MAX1258 inputs
Listing 1 (Sheet 7 of 10)
______________________________________________________________________________________
23
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 1 MAX1258EV listing1
// as single-ended or differential typedef enum { SINGLE_ENDED = 0, UNIPOLAR_DIFFERENTIAL, BIPOLAR_DIFFERENTIAL } MAX1258_channel_config_t; //-------------------------------------------------// C++ class representing the state of a MAX1258 class MAX1258 { public: // MAX1258 registers cannot be read, // so keep track of the register values here. int conversion_register; int new_conversion_register; int setup_register; int setup_unidiff_register; int setup_bipdiff_register; int averaging_register; // int reset_register; int gpio_config; int gpio_data; // int dac_input[8];
06/01/04
8
// The reference voltage is used to calculate the input voltage // represented by each measurement. double Vintref; // internal reference voltage double VpinREF1; // REF1 pin voltage double VpinREF2; // REF2/AIN14 pin voltage double VrefDAC(void); // DAC full-scale voltage depends on setup register double VrefADC(void); // ADC full-scale voltage depends on setup register int adc_code[17]; double DAC_Voltage(int code) { return VrefDAC() * code / 4096; }; // Constructor for class MAX1258. MAX1258(void); // Write a value to one of the part's registers. bool Write_Conversion(int value); bool Write_Setup(int value); bool Write_Setup_UniDiff(int value, int unidiff); bool Write_Setup_BipDiff(int value, int bipdiff); bool Write_Averaging(int value); bool Write_Reset(int value); int Read_Data(int index); int Read_Data_Trigger_Next_Conversion(int index); bool Read_Multiple_Data_Channels(int count); // Input configuration // Array InputPairConfig[] determines whether each pair // of input channels is configured as two single-ended inputs, // a unipolar differential pair, or a bipolar differential pair. MAX1258_channel_config_t InputPairConfig[8]; // // Member function to figure out the values of InputPairConfig // based on the MAX1258 register values. // Call this function afer setting setup_unidiff_register and setup_bipdiff_register // before using the values of InputPairConfig[].
Listing 1 (Sheet 8 of 10)
24
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 1 MAX1258EV listing1
void Update_InputPairConfig(void);
06/01/04
9
// The MAX1258 has a FIFO data buffer with // 16 entries (plus an optional temperature measurement). // Array FIFO_meaning[] determines what to do with // each successive word read from the MAX1258. MAX1258_fifo_entry_t FIFO_meaning[17]; // // Member function to figure out the values of FIFO_meaning // based on the MAX1258 register values. // Call this function afer setting conversion_register, setup_register, and averaging_register // before using the values of FIFO_meaning[]. void Update_FIFO_meaning(void); int channel (MAX1258_fifo_entry_t meaning) { if ((UNIAIN00 <= meaning) && (meaning <= UNIAIN15)) { return (meaning - UNIAIN00); } else if ((UNIDIF0001 <= meaning) && (meaning <= UNIDIF1415)) { return (meaning - UNIDIF0001) * 2; } else if ((BIPDIF0001 <= meaning) && (meaning <= BIPDIF1415)) { return (meaning - BIPDIF0001) * 2; } else if (meaning == TEMPERATURE) { return 16; } else { return 0; } }; // General-Purpose Input/Output pin functions // // Configure the specified GPIO pins as outputs without changing the other pins bool GPIO_Outputs(int pins_mask); // // Configure the specified GPIO pins as inputs without changing the other pins bool GPIO_Inputs(int pins_mask); // // Read the specified GPIO pins int GPIO_Read(int pins_mask); // // Write the specified GPIO output pins high, all other output pins low. bool GPIO_Write(int pins_mask); // // Write the specified GPIO pins high without changing the other pins bool GPIO_Set(int pins_mask); // // Write the specified GPIO pins low without changing the other pins bool GPIO_Clear(int pins_mask); // DAC Analog Outputs // #define MAX1258_MASK_CH1 0x10 #define MAX1258_MASK_CH2 0x20 #define MAX1258_MASK_CH3 0x40 #define MAX1258_MASK_CH4 0x80 #define MAX1258_MASK_CH5 0x01 #define MAX1258_MASK_CH6 0x02 #define MAX1258_MASK_CH7 0x04 #define MAX1258_MASK_CH8 0x08 // // Send the DAC prefix with the no-operation command // MAX1258_DACc_NOP bool DAC_No_Operation(void);
Listing 1 (Sheet 9 of 10)
______________________________________________________________________________________
25
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 1 MAX1258EV listing1
06/01/04
10
// // Reset all DAC channels to all minimum output (all 0's) // MAX1258_DACc_RESET_000 bool DAC_Reset_All_000(void); // // Reset all DAC channels to all maximum output (all 1's) // MAX1258_DACc_RESET_FFF bool DAC_Reset_All_FFF(void); // // Write the specified DAC channel(s) input register, without changing the output value // MAX1258_DACc_WRITE1 .. MAX1258_DACc_WRITE8 bool DAC_Write(int channel_number_12345678, int value); // // Write the specified value to DAC input registers channel 1-4 and update the outputs // MAX1258_DACc_WRITE14LOAD bool DAC_Write_Load_CH1234(int value); // // Write the specified value to DAC input registers channel 5-8 and update the outputs // MAX1258_DACc_WRITE58LOAD bool DAC_Write_Load_CH5678(int value); // // Write the specified value to DAC input registers channel 1-8 and update the outputs // MAX1258_DACc_WRITE18LOAD bool DAC_Write_Load_All(int value); // // Write the specified value to DAC input registers channel 1-8 // MAX1258_DACc_WRITE18 bool DAC_Write_All(int value); // // Update the specified DAC channel(s) output value from the corresponding input register, changing the output value // MAX1258_DACc_LOAD bool DAC_Load_channel(int channel_number_12345678); bool DAC_Load_channels(int channel_mask); // // Power-on the specified DAC channel(s) without changing the others // MAX1258_DACd_PWR_ON bool DAC_PowerOn_channels(int channel_mask); // // Power-off the specified DAC channel(s) high-impedance without changing the others // MAX1258_DACd_PWR_OFF bool DAC_PowerOff_HiZ_channels(int channel_mask); // // Power-off the specified DAC channel(s) VREF-100kohm without changing the others // MAX1258_DACd_PWR_OFF_100K_VREF bool DAC_PowerOff_Vref100k_channels(int channel_mask); // // Power-off the specified DAC channel(s) GND-100kohm without changing the others // MAX1258_DACd_PWR_OFF_100K_AGND bool DAC_PowerOff_Gnd100k_channels(int channel_mask); // // Power-off the specified DAC channel(s) GND-1kohm without changing the others // MAX1258_DACd_PWR_OFF_1K_AGND bool DAC_PowerOff_Gnd1k_channels(int channel_mask);
}; //--------------------------------------------------------------------------#endif // DRV1258H
Listing 1 (Sheet 10 of 10)
26
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2
06/01/04
1
// Drv1258.cpp // MAX1258-specific driver. // mku 04/07/2004 // (C) 2004 Maxim Integrated Products // For use with Borland C++ Builder 3.0 //--------------------------------------------------------------------------// Revision history: // ======================================== // __/__/2004: Initial Release as MAX1258 Version 1.0 // ======================================== //--------------------------------------------------------------------------#include "Drv1258.h" //--------------------------------------------------------------------------// To indicate failure using return value instead of C++ exception, // define the preprocessor symbol THROW_EXCEPTIONS=0. // #ifndef THROW_EXCEPTIONS #define THROW_EXCEPTIONS 1 #endif // // Functions that return a data value must indicate failure by either // throwing a C++ exception, or by returning a value that could never happen. #if THROW_EXCEPTIONS #else #define MAX1258_IMPOSSIBLE_DATA_VALUE 32000 #endif //--------------------------------------------------------------------------MAX1258::MAX1258(void) { conversion_register = MAX1258_CONV_POR; setup_register = MAX1258_SETUP_POR; setup_unidiff_register = MAX1258_SETUP_UNIDIF_POR; setup_bipdiff_register = MAX1258_SETUP_BIPDIF_POR; averaging_register = MAX1258_AVERAGE_POR; //~ Vref = 2.500; Vintref = 4.096; VpinREF1 = 0; VpinREF2 = 0; for (int index = 0; index < 8; index++) { InputPairConfig[index] = SINGLE_ENDED; } for (int index = 0; index < 17; index++) { FIFO_meaning[index] = UNDEFINED; } } //--------------------------------------------------------------------------bool MAX1258::Write_Conversion(int value) { // NOTE: the act of writing to the conversion register // has the effect of triggering one or more conversions // if the clock mode is 10 or 11. value = value &~ 0x00; value = value | 0x80; // x x x x x x x x // 1 x x x x x x x // 1 x x x x x x x
const unsigned __int8 mosi[] = { (unsigned __int8)(value) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { conversion_register = value; }
Listing 2 (Sheet 1 of 14)
______________________________________________________________________________________
27
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2
06/01/04
2
return result; } //--------------------------------------------------------------------------bool MAX1258::Write_Setup(int value) { value = value &~ 0x83; // 0 x x x x x 0 0 value = value | 0x40; // x 1 x x x x x x // 0 1 x x x x 0 0 const unsigned __int8 mosi[] = { (unsigned __int8)(value) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { setup_register = value; Update_FIFO_meaning(); } return result; } //--------------------------------------------------------------------------double MAX1258::VrefDAC(void) { switch (setup_register & MAX1258_SETUP_REF11) { case MAX1258_SETUP_REF00: return Vintref; case MAX1258_SETUP_REF01: return VpinREF1; case MAX1258_SETUP_REF10: return VpinREF1; case MAX1258_SETUP_REF11: return VpinREF1; } return Vintref; } //--------------------------------------------------------------------------double MAX1258::VrefADC(void) { switch (setup_register & MAX1258_SETUP_REF11) { case MAX1258_SETUP_REF00: return Vintref; case MAX1258_SETUP_REF01: return VpinREF2; case MAX1258_SETUP_REF10: return Vintref; case MAX1258_SETUP_REF11: return VpinREF1-VpinREF2; } return Vintref; } //--------------------------------------------------------------------------bool MAX1258::Write_Setup_UniDiff(int value, int unidiff) { value = value &~ 0x81; // 0 x x x x x x 0 value = value | 0x42; // x 1 x x x x 1 x // 0 1 x x x x 1 0 unidiff // 0 1 x x x x 1 0 const unsigned __int8 mosi[] = { (unsigned __int8)(value), (unsigned __int8)(unidiff) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { setup_register = value; setup_unidiff_register = unidiff; Update_InputPairConfig(); Update_FIFO_meaning(); }
Listing 2 (Sheet 2 of 14)
28
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2
06/01/04
3
return result; } //--------------------------------------------------------------------------bool MAX1258::Write_Setup_BipDiff(int value, int bipdiff) { value = value &~ 0x80; // 0 x x x x x x x value = value | 0x43; // x 1 x x x x 1 1 // 0 1 x x x x 1 1 bipdiff // 0 1 x x x x 1 0 const unsigned __int8 mosi[] = { (unsigned __int8)(value), (unsigned __int8)(bipdiff) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { setup_register = value; setup_bipdiff_register = bipdiff; Update_InputPairConfig(); Update_FIFO_meaning(); } return result; } //--------------------------------------------------------------------------bool MAX1258::Write_Averaging(int value) { value = value &~ 0xC0; // 0 0 x x x x x x value = value | 0x20; // x x 1 x x x x x // 0 0 1 x x x x x const unsigned __int8 mosi[] = { (unsigned __int8)(value) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { averaging_register = value; Update_FIFO_meaning(); } return result; } //--------------------------------------------------------------------------bool MAX1258::Write_Reset(int value) { value = value &~ 0xF0; // 0 0 0 0 x x x x value = value | 0x08; // x x x x 1 x x x // 0 0 0 0 1 x x x const unsigned __int8 mosi[] = { (unsigned __int8)(value) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { } return result; } //--------------------------------------------------------------------------int MAX1258::Read_Data(int index) { if ((index < 0) || (index >= 17)) { #if THROW_EXCEPTIONS throw "illegal channel index in MAX1258::Read_Data"; #else return MAX1254_IMPOSSIBLE_DATA_VALUE; #endif } const unsigned __int8 mosi[] = { (unsigned __int8)(0),
Listing 2 (Sheet 3 of 14)
______________________________________________________________________________________
29
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2
06/01/04
4
(unsigned __int8)(0) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { int data16 = (miso_buf[0] * 0x100) + miso_buf[1]; adc_code[index] = data16; return data16; } #if THROW_EXCEPTIONS throw "SPI_Transfer failed in MAX1258::Read_Data"; #else return MAX1258_IMPOSSIBLE_DATA_VALUE; #endif } //--------------------------------------------------------------------------int MAX1258::Read_Data_Trigger_Next_Conversion(int index) { if ((index < 0) || (index >= 17)) { #if THROW_EXCEPTIONS throw "illegal channel index in MAX1258::Read_Data_Trigger_Next_Conversion"; #else return MAX1254_IMPOSSIBLE_DATA_VALUE; #endif } const unsigned __int8 mosi[] = { (unsigned __int8)(0), (unsigned __int8)(conversion_register) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { int data16 = (miso_buf[0] * 0x100) + miso_buf[1]; adc_code[index] = data16; return data16; } #if THROW_EXCEPTIONS throw "SPI_Transfer failed in MAX1258::Read_Data_Trigger_Next_Conversion"; #else return MAX1258_IMPOSSIBLE_DATA_VALUE; #endif } //--------------------------------------------------------------------------bool MAX1258::Read_Multiple_Data_Channels(int count) { switch(setup_register & 0x30) { case 0x00: // 0100xxxx pin16=CNVST, Int clock, Triggered by CNVST pulse // Clock mode 00: // Pulse CNVST pin // Wait for EOC low // issue command "R" to read each 16-bit value from the FIFO // // Update configuration register value only if necessary. if (new_conversion_register != conversion_register) { Write_Conversion(new_conversion_register); } // Trigger conversion by pulsing the CNVST pin. Pulse_MAX1258_CONV(); if (Wait_MAX1258_EOC_Low()) { for (int index = 0; index < count; index++) { Read_Data(index); } } return true; case 0x10: // 0101xxxx pin16=CNVST, Int clock, Triggered by CNVST pulses, custom Tacq // Clock mode 01: // For each requested channel,
Listing 2 (Sheet 4 of 14)
30
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2 06/01/04 5
// Drive CNVST pin low // Delay for the acquisition time (run this delay on 68HC16?) // Drive CNVST pin high // Wait for EOC low // issue command "R" to read each 16-bit value from the FIFO // // Update configuration register value only if necessary. if (new_conversion_register != conversion_register) { Write_Conversion(new_conversion_register); } // Trigger conversion by pulsing the CNVST pin for each channel. for (int index = 0; index < 17; index++) { if (FIFO_meaning[index] != UNDEFINED) { Pulse_MAX1258_CONV(); // TODO: pulse width sets acquisition time for each channel if (Wait_MAX1258_EOC_Low()) { Read_Data(index); } } } return true; case 0x20: // 0110xxxx pin16=AIN15, Int clock, Triggered by conversion register write { // Clock mode 10: // Write to the converion register 1xxx xxxx using command "Wxx" // Wait for EOC low // issue command "R" to read each 16-bit value from the FIFO // // Trigger conversion by writing the conversion register. Write_Conversion(new_conversion_register); if (Wait_MAX1258_EOC_Low()) { for (int index = 0; index < count; index++) { Read_Data(index); } } } return true; case 0x30: // 0111xxxx pin16=AIN15, Ext clock, Triggered by conversion register write // Clock mode 11: // Write to the converion register 1xxx xxxx using command "Wxx" // issue command "R" to read 16-bit value // // Trigger conversion by writing the conversion register. Write_Conversion(new_conversion_register); // Clock mode 11 does not generate an EOC pulse. Read_Data_Trigger_Next_Conversion(0); return true; } return false; // TODO: this code was optimized into machine language file KIT1258.ASM // to increase data throughput. Need to convert back to portable C code, // and probably #ifdef it back to the optimized 68HC16-specific program. } //--------------------------------------------------------------------------void MAX1258::Update_InputPairConfig(void) { for (int index = 0; index < 8; index++) { InputPairConfig[index] = SINGLE_ENDED; } if (setup_bipdiff_register & MAX1258_SETUP_BIPDIF0001) InputPairConfig[0] = BIPOLAR_DIFFERENTIAL; if (setup_bipdiff_register & MAX1258_SETUP_BIPDIF0203) InputPairConfig[1] = BIPOLAR_DIFFERENTIAL; if (setup_bipdiff_register & MAX1258_SETUP_BIPDIF0405) InputPairConfig[2] = BIPOLAR_DIFFERENTIAL; if (setup_bipdiff_register & MAX1258_SETUP_BIPDIF0607)
Listing 2 (Sheet 5 of 14)
______________________________________________________________________________________
31
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2
06/01/04
6
InputPairConfig[3] = BIPOLAR_DIFFERENTIAL; if (setup_bipdiff_register & MAX1258_SETUP_BIPDIF0809) InputPairConfig[4] = BIPOLAR_DIFFERENTIAL; if (setup_bipdiff_register & MAX1258_SETUP_BIPDIF1011) InputPairConfig[5] = BIPOLAR_DIFFERENTIAL; if (setup_bipdiff_register & MAX1258_SETUP_BIPDIF1213) InputPairConfig[6] = BIPOLAR_DIFFERENTIAL; if (setup_bipdiff_register & MAX1258_SETUP_BIPDIF1415) InputPairConfig[7] = BIPOLAR_DIFFERENTIAL; if (setup_unidiff_register & MAX1258_SETUP_UNIDIF0001) InputPairConfig[0] = UNIPOLAR_DIFFERENTIAL; if (setup_unidiff_register & MAX1258_SETUP_UNIDIF0203) InputPairConfig[1] = UNIPOLAR_DIFFERENTIAL; if (setup_unidiff_register & MAX1258_SETUP_UNIDIF0405) InputPairConfig[2] = UNIPOLAR_DIFFERENTIAL; if (setup_unidiff_register & MAX1258_SETUP_UNIDIF0607) InputPairConfig[3] = UNIPOLAR_DIFFERENTIAL; if (setup_unidiff_register & MAX1258_SETUP_UNIDIF0809) InputPairConfig[4] = UNIPOLAR_DIFFERENTIAL; if (setup_unidiff_register & MAX1258_SETUP_UNIDIF1011) InputPairConfig[5] = UNIPOLAR_DIFFERENTIAL; if (setup_unidiff_register & MAX1258_SETUP_UNIDIF1213) InputPairConfig[6] = UNIPOLAR_DIFFERENTIAL; if (setup_unidiff_register & MAX1258_SETUP_UNIDIF1415) InputPairConfig[7] = UNIPOLAR_DIFFERENTIAL; } //--------------------------------------------------------------------------void MAX1258::Update_FIFO_meaning(void) { int conversion_register = new_conversion_register; for (int index = 0; index < 17; index++) { FIFO_meaning[index] = UNDEFINED; } int channel_field = (conversion_register >> 3) & 0x0F; int channel_index = channel_field; int repeat_count = 4; switch(averaging_register & 0xE3) { case MAX1258_REPEAT_4: // 001xxx00 4 times repeat_count = 4; break; case MAX1258_REPEAT_8: // 001xxx01 8 times repeat_count = 8; break; case MAX1258_REPEAT_12: // 001xxx10 12 times repeat_count = 12; break; case MAX1258_REPEAT_16: // 001xxx11 16 times repeat_count = 16; break; } MAX1258_fifo_entry_t meaning = (MAX1258_fifo_entry_t)(UNIAIN00 + channel_field); if (InputPairConfig[channel_field / 2] == BIPOLAR_DIFFERENTIAL) { meaning = (MAX1258_fifo_entry_t)(BIPDIF0001 + channel_field/2); } else if (InputPairConfig[channel_field / 2] == UNIPOLAR_DIFFERENTIAL) { meaning = (MAX1258_fifo_entry_t)(UNIDIF0001 + channel_field/2); } int index = 0; switch(conversion_register & MAX1258_ACTION_MASK) { case MAX1258_CONV_SCAN_00_N: meaning = UNIAIN00; channel_index = 0; while(channel_index <= channel_field) { int pair_index = channel_index / 2; if (InputPairConfig[pair_index] == BIPOLAR_DIFFERENTIAL) {
Listing 2 (Sheet 6 of 14)
32
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2 06/01/04 7
meaning = (MAX1258_fifo_entry_t)(BIPDIF0001 + pair_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 2; } else if (InputPairConfig[pair_index] == UNIPOLAR_DIFFERENTIAL) { meaning = (MAX1258_fifo_entry_t)(UNIDIF0001 + pair_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 2; } else { meaning = (MAX1258_fifo_entry_t)(UNIAIN00 + channel_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 1; } } break; case MAX1258_CONV_SCAN_T_00_N: FIFO_meaning[index++] = TEMPERATURE; meaning = UNIAIN00; channel_index = 0; while(channel_index <= channel_field) { int pair_index = channel_index / 2; if (InputPairConfig[pair_index] == BIPOLAR_DIFFERENTIAL) { meaning = (MAX1258_fifo_entry_t)(BIPDIF0001 + pair_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 2; } else if (InputPairConfig[pair_index] == UNIPOLAR_DIFFERENTIAL) { meaning = (MAX1258_fifo_entry_t)(UNIDIF0001 + pair_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 2; } else { meaning = (MAX1258_fifo_entry_t)(UNIAIN00 + channel_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 1; } } break; case MAX1258_CONV_SCAN_N_15: while (index < 17) { int pair_index = channel_index / 2; if (InputPairConfig[pair_index] == BIPOLAR_DIFFERENTIAL) { meaning = (MAX1258_fifo_entry_t)(BIPDIF0001 + pair_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 2; } else if (InputPairConfig[pair_index] == UNIPOLAR_DIFFERENTIAL) { meaning = (MAX1258_fifo_entry_t)(UNIDIF0001 + pair_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 2; } else { meaning = (MAX1258_fifo_entry_t)(UNIAIN00 + channel_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 1; } if (meaning == UNIAIN15) break; if (meaning == UNIDIF1415) break; if (meaning == BIPDIF1415) break; } break; case MAX1258_CONV_SCAN_T_N_15: FIFO_meaning[index++] = TEMPERATURE; while (index < 17) { int pair_index = channel_index / 2; if (InputPairConfig[pair_index] == BIPOLAR_DIFFERENTIAL) { meaning = (MAX1258_fifo_entry_t)(BIPDIF0001 + pair_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 2; } else if (InputPairConfig[pair_index] == UNIPOLAR_DIFFERENTIAL) { meaning = (MAX1258_fifo_entry_t)(UNIDIF0001 + pair_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 2; } else { meaning = (MAX1258_fifo_entry_t)(UNIAIN00 + channel_index); FIFO_meaning[index++] = meaning; channel_index = channel_index + 1;
Listing 2 (Sheet 7 of 14)
______________________________________________________________________________________
33
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2 06/01/04 8
} if (meaning == UNIAIN15) break; if (meaning == UNIDIF1415) break; if (meaning == BIPDIF1415) break; } break; case MAX1258_CONV_SINGLE_REPEAT: while (index < repeat_count) { FIFO_meaning[index++] = meaning; } break; case MAX1258_CONV_SINGLE_READ: FIFO_meaning[index++] = meaning; break; } /* Check for setups where AIN14-AIN15 are used for an alternate function */ if ((setup_register & 0xE0) == MAX1258_SETUP_INTCLK_CNVST) { /* 0100xxxx AIN15 alternate function as CNVST input */ /* 0101xxxx AIN15 alternate function as CNVST input */ for (int index = 0; index < 17; index++) { meaning = FIFO_meaning[index]; if (meaning == UNIAIN15) FIFO_meaning[index] = UNDEFINED; if (meaning == UNIDIF1415) FIFO_meaning[index] = UNDEFINED; if (meaning == BIPDIF1415) FIFO_meaning[index] = UNDEFINED; } } // MAX1258 AIN14 alternate pin function in mode 01xx01xx */ #if 1 switch (setup_register & 0xCC) { case MAX1258_SETUP_EXTREF: case MAX1258_SETUP_EXTREF_DIFF: /* AIN14 alternate function as REF2 input */ for (int index = 0; index < 17; index++) { meaning = FIFO_meaning[index]; if (meaning == UNIAIN14) FIFO_meaning[index] = UNDEFINED; if (meaning == UNIDIF1415) FIFO_meaning[index] = UNDEFINED; if (meaning == BIPDIF1415) FIFO_meaning[index] = UNDEFINED; } break; default: break; } #else if ((setup_register & 0xCC) == MAX1258_SETUP_EXTREF_DIFF) { /* MAX1231: 01xx11xx AIN14 alternate function as REF- input */ for (int index = 0; index < 17; index++) { meaning = FIFO_meaning[index]; if (meaning == UNIAIN14) FIFO_meaning[index] = UNDEFINED; if (meaning == UNIDIF1415) FIFO_meaning[index] = UNDEFINED; if (meaning == BIPDIF1415) FIFO_meaning[index] = UNDEFINED; } } #endif } //--------------------------------------------------------------------------bool MAX1258::GPIO_Outputs(int pins_mask) { gpio_config = gpio_config | pins_mask;
Listing 2 (Sheet 8 of 14)
34
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2
06/01/04
9
const unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_GPIO_CONFIG), (unsigned __int8)(gpio_config / 0x100), (unsigned __int8)(gpio_config & 0xFF) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { return true; // success } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::GPIO_Inputs(int pins_mask) { //~ To configure a pin for input requires writing BOTH //~ a MAX1258_GPIO_CONFIG with bit = 0 and also //~ a MAX1258_GPIO_WRITE with bit = 1. //~ Writing CONFIG = 0 and WRITE = 0 will configure the pin for "open-drain pull-down" mode. Not input. gpio_config = gpio_config &~ pins_mask; const unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_GPIO_CONFIG), (unsigned __int8)(gpio_config / 0x100), (unsigned __int8)(gpio_config & 0xFF) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { return GPIO_Write(gpio_data | pins_mask); } // else operation failed return false; } //--------------------------------------------------------------------------int MAX1258::GPIO_Read(int pins_mask) { const unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_GPIO_READ), (unsigned __int8)(0), (unsigned __int8)(0) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success unsigned __int16 pins = miso_buf[1] * 0x100 + miso_buf[2]; return (pins & pins_mask); } // else operation failed return 0; } //--------------------------------------------------------------------------bool MAX1258::GPIO_Write(int pins_mask) { gpio_data = pins_mask; const unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_GPIO_WRITE), (unsigned __int8)(gpio_data / 0x100), (unsigned __int8)(gpio_data & 0xFF) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { return true; // success } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::GPIO_Set(int pins_mask)
Listing 2 (Sheet 9 of 14)
______________________________________________________________________________________
35
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2
{
06/01/04
10
return GPIO_Write(gpio_data | pins_mask); } //--------------------------------------------------------------------------bool MAX1258::GPIO_Clear(int pins_mask) { return GPIO_Write(gpio_data &~ pins_mask); } //--------------------------------------------------------------------------bool MAX1258::DAC_No_Operation(void) { // Send the DAC prefix with the no-operation command unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)(MAX1258_DACc_NOP), (unsigned __int8)(0) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_Reset_All_000(void) { // Reset all DAC channels to all minimum output (all 0's) unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)(MAX1258_DACc_RESET_000), (unsigned __int8)(0) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_Reset_All_FFF(void) { // Reset all DAC channels to all maximum output (all 1's) unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)(MAX1258_DACc_RESET_FFF), (unsigned __int8)(0) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_Write(int channel_number_12345678, int DAC_value) { // Write the specified DAC channel(s) input register, without changing the output value unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)(DAC_value >> 8 & 0x0F), (unsigned __int8)(DAC_value & 0xFF) };
Listing 2 (Sheet 10 of 14)
36
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2 06/01/04 11
switch (channel_number_12345678) { case 1: mosi[1] |= MAX1258_DACc_WRITE1; break; case 2: mosi[1] |= MAX1258_DACc_WRITE2; break; case 3: mosi[1] |= MAX1258_DACc_WRITE3; break; case 4: mosi[1] |= MAX1258_DACc_WRITE4; break; case 5: mosi[1] |= MAX1258_DACc_WRITE5; break; case 6: mosi[1] |= MAX1258_DACc_WRITE6; break; case 7: mosi[1] |= MAX1258_DACc_WRITE7; break; case 8: mosi[1] |= MAX1258_DACc_WRITE8; break; default: return false; // invalid channel mask } unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_Load_channel(int channel_number_12345678) { // Update the specified DAC channel(s) output value from the corresponding input register, changing the output value unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)(MAX1258_DACc_LOAD), (unsigned __int8)(0) }; switch (channel_number_12345678) { case 1: mosi[2] |= MAX1258_DACd_CH1; break; case 2: mosi[2] |= MAX1258_DACd_CH2; break; case 3: mosi[2] |= MAX1258_DACd_CH3; break; case 4: mosi[2] |= MAX1258_DACd_CH4; break; case 5: mosi[1] |= MAX1258_DACc_CH5; break; case 6: mosi[1] |= MAX1258_DACc_CH6; break; case 7: mosi[1] |= MAX1258_DACc_CH7; break; case 8: mosi[1] |= MAX1258_DACc_CH8; break; default: return false; // invalid channel mask } unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_Load_channels(int channel_mask) { // Update the specified DAC channel(s) output value from the corresponding input register, changing the output value unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)(MAX1258_DACc_LOAD), (unsigned __int8)(0) }; if (channel_mask & MAX1258_MASK_CH1) mosi[2] |= MAX1258_DACd_CH1; if (channel_mask & MAX1258_MASK_CH2) mosi[2] |= MAX1258_DACd_CH2; if (channel_mask & MAX1258_MASK_CH3) mosi[2] |= MAX1258_DACd_CH3; if (channel_mask & MAX1258_MASK_CH4) mosi[2] |= MAX1258_DACd_CH4; if (channel_mask & MAX1258_MASK_CH5) mosi[1] |= MAX1258_DACc_CH5; if (channel_mask & MAX1258_MASK_CH6) mosi[1] |= MAX1258_DACc_CH6; if (channel_mask & MAX1258_MASK_CH7) mosi[1] |= MAX1258_DACc_CH7; if (channel_mask & MAX1258_MASK_CH8) mosi[1] |= MAX1258_DACc_CH8; unsigned __int8 miso_buf[sizeof(mosi)];
Listing 2 (Sheet 11 of 14)
______________________________________________________________________________________
37
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2
06/01/04
12
bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_Write_Load_CH1234(int value) { unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)((value >> 8 & 0x0F) | MAX1258_DACc_WRITE14LOAD), (unsigned __int8)(value & 0xFF) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_Write_Load_CH5678(int value) { unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)((value >> 8 & 0x0F) | MAX1258_DACc_WRITE58LOAD), (unsigned __int8)(value & 0xFF) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_Write_Load_All(int value) { unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)((value >> 8 & 0x0F) | MAX1258_DACc_WRITE18LOAD), (unsigned __int8)(value & 0xFF) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_Write_All(int value) { unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)((value >> 8 & 0x0F) | MAX1258_DACc_WRITE18), (unsigned __int8)(value & 0xFF) }; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true;
Listing 2 (Sheet 12 of 14)
38
______________________________________________________________________________________
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2
} // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_PowerOn_channels(int channel_mask) { // Power-on the specified DAC channel(s) without changing the others unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)(MAX1258_DACc_PWR), (unsigned __int8)(MAX1258_DACd_PWR_ON) }; if (channel_mask & MAX1258_MASK_CH1) mosi[2] |= MAX1258_DACd_CH1; if (channel_mask & MAX1258_MASK_CH2) mosi[2] |= MAX1258_DACd_CH2; if (channel_mask & MAX1258_MASK_CH3) mosi[2] |= MAX1258_DACd_CH3; if (channel_mask & MAX1258_MASK_CH4) mosi[2] |= MAX1258_DACd_CH4; if (channel_mask & MAX1258_MASK_CH5) mosi[1] |= MAX1258_DACc_CH5; if (channel_mask & MAX1258_MASK_CH6) mosi[1] |= MAX1258_DACc_CH6; if (channel_mask & MAX1258_MASK_CH7) mosi[1] |= MAX1258_DACc_CH7; if (channel_mask & MAX1258_MASK_CH8) mosi[1] |= MAX1258_DACc_CH8; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_PowerOff_HiZ_channels(int channel_mask) { // Power-off the specified DAC channel(s) high-impedance without changing the others unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)(MAX1258_DACc_PWR), (unsigned __int8)(MAX1258_DACd_PWR_OFF) }; if (channel_mask & MAX1258_MASK_CH1) mosi[2] |= MAX1258_DACd_CH1; if (channel_mask & MAX1258_MASK_CH2) mosi[2] |= MAX1258_DACd_CH2; if (channel_mask & MAX1258_MASK_CH3) mosi[2] |= MAX1258_DACd_CH3; if (channel_mask & MAX1258_MASK_CH4) mosi[2] |= MAX1258_DACd_CH4; if (channel_mask & MAX1258_MASK_CH5) mosi[1] |= MAX1258_DACc_CH5; if (channel_mask & MAX1258_MASK_CH6) mosi[1] |= MAX1258_DACc_CH6; if (channel_mask & MAX1258_MASK_CH7) mosi[1] |= MAX1258_DACc_CH7; if (channel_mask & MAX1258_MASK_CH8) mosi[1] |= MAX1258_DACc_CH8; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_PowerOff_Vref100k_channels(int channel_mask) { // Power-off the specified DAC channel(s) VREF-100kohm without changing the others unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)(MAX1258_DACc_PWR), (unsigned __int8)(MAX1258_DACd_PWR_OFF_100K_VREF) }; if (channel_mask & MAX1258_MASK_CH1) mosi[2] |= MAX1258_DACd_CH1; if (channel_mask & MAX1258_MASK_CH2) mosi[2] |= MAX1258_DACd_CH2; if (channel_mask & MAX1258_MASK_CH3) mosi[2] |= MAX1258_DACd_CH3; if (channel_mask & MAX1258_MASK_CH4) mosi[2] |= MAX1258_DACd_CH4; if (channel_mask & MAX1258_MASK_CH5) mosi[1] |= MAX1258_DACc_CH5; if (channel_mask & MAX1258_MASK_CH6) mosi[1] |= MAX1258_DACc_CH6; if (channel_mask & MAX1258_MASK_CH7) mosi[1] |= MAX1258_DACc_CH7;
06/01/04
13
Listing 2 (Sheet 13 of 14)
______________________________________________________________________________________
39
MAX1258 Evaluation Kit/Evaluation System Evaluate: MAX1057/MAX1058/MAX1257/MAX1258
MAX1258 EV kit Listing 2 MAX1258EV listing2 06/01/04 14
if (channel_mask & MAX1258_MASK_CH8) mosi[1] |= MAX1258_DACc_CH8; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_PowerOff_Gnd100k_channels(int channel_mask) { // Power-off the specified DAC channel(s) GND-100kohm without changing the others unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)(MAX1258_DACc_PWR), (unsigned __int8)(MAX1258_DACd_PWR_OFF_100K_AGND) }; if (channel_mask & MAX1258_MASK_CH1) mosi[2] |= MAX1258_DACd_CH1; if (channel_mask & MAX1258_MASK_CH2) mosi[2] |= MAX1258_DACd_CH2; if (channel_mask & MAX1258_MASK_CH3) mosi[2] |= MAX1258_DACd_CH3; if (channel_mask & MAX1258_MASK_CH4) mosi[2] |= MAX1258_DACd_CH4; if (channel_mask & MAX1258_MASK_CH5) mosi[1] |= MAX1258_DACc_CH5; if (channel_mask & MAX1258_MASK_CH6) mosi[1] |= MAX1258_DACc_CH6; if (channel_mask & MAX1258_MASK_CH7) mosi[1] |= MAX1258_DACc_CH7; if (channel_mask & MAX1258_MASK_CH8) mosi[1] |= MAX1258_DACc_CH8; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //--------------------------------------------------------------------------bool MAX1258::DAC_PowerOff_Gnd1k_channels(int channel_mask) { // Power-off the specified DAC channel(s) GND-1kohm without changing the others unsigned __int8 mosi[] = { (unsigned __int8)(MAX1258_DAC), (unsigned __int8)(MAX1258_DACc_PWR), (unsigned __int8)(MAX1258_DACd_PWR_OFF_1K_AGND) }; if (channel_mask & MAX1258_MASK_CH1) mosi[2] |= MAX1258_DACd_CH1; if (channel_mask & MAX1258_MASK_CH2) mosi[2] |= MAX1258_DACd_CH2; if (channel_mask & MAX1258_MASK_CH3) mosi[2] |= MAX1258_DACd_CH3; if (channel_mask & MAX1258_MASK_CH4) mosi[2] |= MAX1258_DACd_CH4; if (channel_mask & MAX1258_MASK_CH5) mosi[1] |= MAX1258_DACc_CH5; if (channel_mask & MAX1258_MASK_CH6) mosi[1] |= MAX1258_DACc_CH6; if (channel_mask & MAX1258_MASK_CH7) mosi[1] |= MAX1258_DACc_CH7; if (channel_mask & MAX1258_MASK_CH8) mosi[1] |= MAX1258_DACc_CH8; unsigned __int8 miso_buf[sizeof(mosi)]; bool result = SPI_Transfer_MISO_Delayed(sizeof(mosi), mosi, miso_buf); if (result) { // success return true; } // else operation failed return false; } //---------------------------------------------------------------------------
Listing 2 (Sheet 14 of 14)
Maxim cannot assume responsibility for use of any circuitry other than circuitry entirely embodied in a Maxim product. No circuit patent licenses are implied. Maxim reserves the right to change the circuitry and specifications without notice at any time.
40 ____________________Maxim Integrated Products, 120 San Gabriel Drive, Sunnyvale, CA 94086 408-737-7600 (c) 2004 Maxim Integrated Products Printed USA is a registered trademark of Maxim Integrated Products.


▲Up To Search▲   

 
Price & Availability of MAX1258EVKIT

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X